#pragma once
#include"preCmpH.h"

BEGIN_NAMESPACE(ui_manager)
BEGIN_NAMESPACE(ui_graphics)

class UIRenderer;

class UIImage;
typedef std::shared_ptr<UIImage> UIImagePtr; // Shared pointer to manage dynamic UIImage objects

class UIImage
{
public:
	UIImage();
	UIImage& operator= (const UIImage& img);
	~UIImage();
	// Setters
	void SetWidth( int w){w_ = w;}
	void SetHeight( int h){h_ = h;}
	void SetFormat( int format){format_ = format;}
	void SetType( int type){type_ = type;}
	void SetName(std::string name){name_ = name;}
	void Clear();
	// Getters
	int GetWidth() const {return w_;}
	int GetHeight() const {return h_;}
	int GetFormat() const {return format_;}
	int GetType() const {return type_;}
	std::string GetName()const{return name_;}
	int IsEmpty() const
	{
		return (id_ == 0) ? true : false;
	}

	enum{FORMAT_RED,
		FORMAT_GREEN,
		FORMAT_BLUE,
		FORMAT_ALPHA,
		FORMAT_RGB,
		FORMAT_RGBA,
		FORMAT_BGR,
		FORMAT_BGRA};
	enum{TYPE_U_BYTE,
		TYPE_BYTE,
		TYPE_U_SHORT,
		TYPE_SHORT,
		TYPE_U_INT,
		TYPE_INT,
		TYPE_FLOAT};
	UIImage(const UIImage& img);
private:
	int w_;
	int h_;

	uint id_;
	int format_;
	int type_;
	std::string name_;

	void SetId(uint id){id_ = id;}
	uint GetId()const{return id_;}

	friend class UIRenderer;
};

END_NAMESPACE // ui manager
END_NAMESPACE // ui graphics